'use strict';

const mongooseAutoPopulate = require('mongoose-autopopulate');

/**
 * 针对 mongoose 全局配置插件
 * @param app
 */
module.exports = app => {
  const mongoose = app.mongoose;

  // 设置debug 模式
  mongoose.set('debug', app.config.env !== 'prod');

  // auto populate
  mongoose.plugin(mongooseAutoPopulate);
};
